function teamsel( ply )
local Panel = vgui.Create( "DFrame")
	Panel:SetSize( 250, 250 )
	Panel:Center()
	Panel:SetVisible( true )
	Panel:SetDraggable( false )
	Panel:ShowCloseButton( false )
	Panel:SetTitle( " " )
	Panel:MakePopup()
	Panel.Paint = function()
		draw.RoundedBox( 3, 0, 0, 250, 250, Color(120, 120, 120, 255) )
		draw.RoundedBox( 0, 0, 0, 250, 20, Color(170, 170, 170, 255) )
		draw.SimpleText("Select Team", "ScoreboardText", 10, 2, Color(0,0,0,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 1, Color(255,255,255,255))

	end
	
local Blue = vgui.Create( "DButton", Panel )
Blue:SetText( "Blue" )
Blue:SetPos( 10, 30 )
Blue:SetSize( 70, 50 )
Blue.Paint = function()
	draw.RoundedBox( 0, 1, 1, 68, 48, Color(70, 70, 250, 100) )
end
Blue.DoClick = function ()
	RunConsoleCommand("dm_team","blue")
	Panel:SetVisible( false )
	if LocalPlayer():GetNetworkedInt("new") == 1 then
		RunConsoleCommand("dm_classmenu")
	end
end

local BluePlayerList = vgui.Create( "DComboBox", Panel )
BluePlayerList:SetPos( 10, 90 )
BluePlayerList:SetSize( 110, 150 )
BluePlayerList:SetMultiple( false )
BluePlayerList:Clear()
for k, v in pairs(player.GetAll()) do
	if v:Team() == 1 then
		BluePlayerList:AddItem(v:Nick())
	end
end

local Red = vgui.Create( "DButton", Panel )
Red:SetText( "Red" )
Red:SetPos( 170, 30 )
Red:SetSize( 70, 50 )
Red.Paint = function()
	draw.RoundedBox( 0, 1, 1, 68, 48, Color(250, 70, 70, 100) )
end
Red.DoClick = function ()
	RunConsoleCommand("dm_team","red")
	Panel:SetVisible( false )
	if LocalPlayer():GetNetworkedInt("new") == 1 then
		RunConsoleCommand("dm_classmenu")
	end
end

local RedPlayerList = vgui.Create( "DComboBox", Panel )
RedPlayerList:SetPos( 130, 90 )
RedPlayerList:SetSize( 110, 150 )
RedPlayerList:SetMultiple( false )
RedPlayerList:Clear()
for k, v in pairs(player.GetAll()) do
	if v:Team() == 2 then
		RedPlayerList:AddItem(v:Nick())
	end
end



end

concommand.Add("dm_teamsel",teamsel)

function classmenu()
local Panel = vgui.Create( "DFrame")
	Panel:SetSize( 500, 500 )
	Panel:Center()
	Panel:SetVisible( true )
	Panel:SetDraggable( false )
	Panel:ShowCloseButton( false )
	Panel:SetTitle( " " )
	Panel:MakePopup()
	Panel.Paint = function()
		draw.RoundedBox( 3, 0, 0, 500, 500, Color(120, 120, 120, 255) )
		draw.RoundedBox( 0, 0, 0, 500, 20, Color(170, 170, 170, 255) )
		draw.SimpleText("Select Class", "ScoreboardText", 10, 2, Color(0,0,0,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 1, Color(255,255,255,255))
	end
	
	
--- Soldier
local Label = vgui.Create("DLabel", Panel)
Label:SetText("Soldier")
Label:SetPos( 50, 30 )
	
local Soldier = vgui.Create( "DButton", Panel )
Soldier:SetText( " " )
Soldier:SetPos( 30, 60 )
Soldier:SetSize( 100, 100 )
Soldier.Paint = function()
	draw.RoundedBox( 1, 1, 1, 98, 98, Color(140, 140, 140, 255) )
end
local SoldierModel = vgui.Create( "DModelPanel", Panel )
SoldierModel:SetModel( Model("models/Humans/Group03/Male_0"..math.random(1,9)..".mdl") )
SoldierModel:SetSize( 100, 100 )
SoldierModel:SetPos( 30, 60 )
SoldierModel:SetCamPos( Vector( 70, 0, 40 ) )
SoldierModel:SetLookAt( Vector( 0, 0, 50 ) )
SoldierModel:SetAnimated( false )
SoldierModel.DoClick = function ()

	local SoldierInfo = vgui.Create( "DFrame" )
	SoldierInfo:SetSize( 300, 300 )
	SoldierInfo:Center()
	SoldierInfo:SetTitle( "" )
	SoldierInfo:SetVisible( true )
	SoldierInfo:SetDraggable( true )
	SoldierInfo:ShowCloseButton( true )
	SoldierInfo:MakePopup()
	SoldierInfo.Paint = function()
		draw.RoundedBox( 2, 0, 0, 300, 300, Color(70, 70, 70, 255) )
		draw.RoundedBox( 2, 1, 1, 298, 298, Color(120, 120, 120, 255) )
		draw.RoundedBox( 0, 0, 0, 300, 20, Color(170, 170, 170, 255) )
		draw.SimpleText("Soldier Info", "ScoreboardText", 10, 2, Color(0,0,0,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 1, Color(255,255,255,255))
		draw.DrawText("Primary Unlocks:\n"..GetWeaponLvl("Primary","Soldier").."\n\n\nSecondary Unlocks:\n"..GetWeaponLvl("Secondary","Soldier"), "DefaultFixed", 6, 30, Color(255,255,255,255),TEXT_ALIGN_LEFT)
	end
	
	
	local SoldierC = vgui.Create( "DButton", SoldierInfo )
	SoldierC:SetText( "Choose" )
	SoldierC:SetPos( 30, 230 )
	SoldierC:SetSize( 70, 50 )
	SoldierC.Paint = function()
		draw.RoundedBox( 1, 1, 1, 68, 48, Color(140, 140, 140, 255) )
	end
	SoldierC.DoClick = function()
		RunConsoleCommand("dm_classchange", "soldier")
		SoldierInfo:SetVisible( false )
		Panel:SetVisible( false )
	end
end


--- support
local Label = vgui.Create("DLabel", Panel)
Label:SetText("Support")
Label:SetPos( 160, 30 )

local support = vgui.Create( "DButton", Panel )
support:SetText( " " )
support:SetPos( 140, 60 )
support:SetSize( 100, 100 )
support.Paint = function()
	draw.RoundedBox( 1, 1, 1, 98, 98, Color(140, 140, 140, 255) )
end

local supportModel = vgui.Create( "DModelPanel", Panel )
supportModel:SetModel( Model("models/Humans/Group03m/Male_0"..math.random(1,7)..".mdl") )
supportModel:SetSize( 100, 100 )
supportModel:SetPos( 140, 60 )
supportModel:SetCamPos( Vector( 70, 0, 40 ) )
supportModel:SetLookAt( Vector( 0, 0, 50 ) )
supportModel:SetAnimated( false )
supportModel.DoClick = function ()

	local supportInfo = vgui.Create( "DFrame" )
	supportInfo:SetSize( 300, 300 )
	supportInfo:Center()
	supportInfo:SetTitle( "" )
	supportInfo:SetVisible( true )
	supportInfo:SetDraggable( true )
	supportInfo:ShowCloseButton( true )
	supportInfo:MakePopup()
	supportInfo.Paint = function()
		draw.RoundedBox( 2, 0, 0, 300, 300, Color(70, 70, 70, 255) )
		draw.RoundedBox( 2, 1, 1, 298, 298, Color(120, 120, 120, 255) )
		draw.RoundedBox( 0, 0, 0, 300, 20, Color(170, 170, 170, 255) )
		draw.SimpleText("Support Info", "ScoreboardText", 10, 2, Color(0,0,0,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 1, Color(255,255,255,255))
		draw.DrawText("Primary Unlocks:\n"..GetWeaponLvl("Primary","Support").."\n\n\nSecondary Unlocks:\n"..GetWeaponLvl("Secondary","Support"), "DefaultFixed", 6, 30, Color(255,255,255,255),TEXT_ALIGN_LEFT)
	end
	
	
	local supportC = vgui.Create( "DButton", supportInfo )
	supportC:SetText( "Choose" )
	supportC:SetPos( 30, 230 )
	supportC:SetSize( 70, 50 )
	supportC.Paint = function()
		draw.RoundedBox( 1, 1, 1, 68, 48, Color(140, 140, 140, 255) )
	end
	supportC.DoClick = function()
		RunConsoleCommand("dm_classchange", "support")
		supportInfo:SetVisible( false )
		Panel:SetVisible( false )
	end
end


---   Assassin
local Label = vgui.Create("DLabel", Panel)
Label:SetText("Assassin")
Label:SetPos( 270, 30 )

local Assassin = vgui.Create( "DButton", Panel )
Assassin:SetText( " " )
Assassin:SetPos( 250, 60 )
Assassin:SetSize( 100, 100 )
Assassin.Paint = function()
	draw.RoundedBox( 1, 1, 1, 98, 98, Color(140, 140, 140, 255) )
end

local AssassinModel = vgui.Create( "DModelPanel", Panel )
AssassinModel:SetModel( Model("models/Humans/Group02/Male_0"..(math.random(1,4)*2)..".mdl") )
AssassinModel:SetSize( 100, 100 )
AssassinModel:SetPos( 250, 60 )
AssassinModel:SetCamPos( Vector( 70, 0, 40 ) )
AssassinModel:SetLookAt( Vector( 0, 0, 50 ) )
AssassinModel:SetAnimated( false )
AssassinModel.DoClick = function ()

	local AssassinInfo = vgui.Create( "DFrame" )
	AssassinInfo:SetSize( 300, 300 )
	AssassinInfo:Center()
	AssassinInfo:SetTitle( "" )
	AssassinInfo:SetVisible( true )
	AssassinInfo:SetDraggable( true )
	AssassinInfo:ShowCloseButton( true )
	AssassinInfo:MakePopup()
	AssassinInfo.Paint = function()
		draw.RoundedBox( 2, 0, 0, 300, 300, Color(70, 70, 70, 255) )
		draw.RoundedBox( 2, 1, 1, 298, 298, Color(120, 120, 120, 255) )
		draw.RoundedBox( 0, 0, 0, 300, 20, Color(170, 170, 170, 255) )
		draw.SimpleText("Assassin Info", "ScoreboardText", 10, 2, Color(0,0,0,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 1, Color(255,255,255,255))
		draw.DrawText("Primary Unlocks:\n"..GetWeaponLvl("Primary","Assassin").."\n\n\nSecondary Unlocks:\n"..GetWeaponLvl("Secondary","Assassin"), "DefaultFixed", 6, 30, Color(255,255,255,255),TEXT_ALIGN_LEFT)
	end
	
	
	local AssassinC = vgui.Create( "DButton", AssassinInfo )
	AssassinC:SetText( "Choose" )
	AssassinC:SetPos( 30, 230 )
	AssassinC:SetSize( 70, 50 )
	AssassinC.Paint = function()
		draw.RoundedBox( 1, 1, 1, 68, 48, Color(140, 140, 140, 255) )
	end
	AssassinC.DoClick = function()
		RunConsoleCommand("dm_classchange", "assassin")
		AssassinInfo:SetVisible( false )
		Panel:SetVisible( false )
	end
end


--- Marksman
local Label = vgui.Create("DLabel", Panel)
Label:SetText("Marksman")
Label:SetPos( 380, 30 )

local Marksman = vgui.Create( "DButton", Panel )
Marksman:SetText( " " )
Marksman:SetPos( 360, 60 )
Marksman:SetSize( 100, 100 )
Marksman.Paint = function()
	draw.RoundedBox( 1, 1, 1, 98, 98, Color(140, 140, 140, 255) )
end

local MarksmanModel = vgui.Create( "DModelPanel", Panel )
MarksmanModel:SetModel( Model("models/Humans/Group01/Male_0"..math.random(1,9)..".mdl") )
MarksmanModel:SetSize( 100, 100 )
MarksmanModel:SetPos( 360, 60 )
MarksmanModel:SetCamPos( Vector( 70, 0, 40 ) )
MarksmanModel:SetLookAt( Vector( 0, 0, 50 ) )
MarksmanModel:SetAnimated( false )
MarksmanModel.DoClick = function ()

	local MarksmanInfo = vgui.Create( "DFrame" )
	MarksmanInfo:SetSize( 300, 300 )
	MarksmanInfo:Center()
	MarksmanInfo:SetTitle( "" )
	MarksmanInfo:SetVisible( true )
	MarksmanInfo:SetDraggable( true )
	MarksmanInfo:ShowCloseButton( true )
	MarksmanInfo:MakePopup()
	MarksmanInfo.Paint = function()
		draw.RoundedBox( 2, 0, 0, 300, 300, Color(70, 70, 70, 255) )
		draw.RoundedBox( 2, 1, 1, 298, 298, Color(120, 120, 120, 255) )
		draw.RoundedBox( 0, 0, 0, 300, 20, Color(170, 170, 170, 255) )
		draw.SimpleText("Marksman Info", "ScoreboardText", 10, 2, Color(0,0,0,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 1, Color(255,255,255,255))
		draw.DrawText("Primary Unlocks:\n"..GetWeaponLvl("Primary","Marksman").."\n\n\nSecondary Unlocks:\n"..GetWeaponLvl("Secondary","Marksman"), "DefaultFixed", 6, 30, Color(255,255,255,255),TEXT_ALIGN_LEFT)
	end
	
	
	local MarksmanC = vgui.Create( "DButton", MarksmanInfo )
	MarksmanC:SetText( "Choose" )
	MarksmanC:SetPos( 30, 230 )
	MarksmanC:SetSize( 70, 50 )
	MarksmanC.Paint = function()
		draw.RoundedBox( 1, 1, 1, 68, 48, Color(140, 140, 140, 255) )
	end
	MarksmanC.DoClick = function()
		RunConsoleCommand("dm_classchange", "marksman")
		MarksmanInfo:SetVisible( false )
		Panel:SetVisible( false )
	end
end



end

concommand.Add("dm_classmenu",classmenu)


function GetWeaponLvl(type,class)
	local weplvl = ""
	for i = 1, 5 do
		if Weapons[type][class][i] then
			weplvl = weplvl.."\n	Level "..i..": "..WepName(Weapons[type][class][i])
		else
			weplvl = weplvl.."\n	Level "..i..": <none>"
		end
	end
	return weplvl
end

